<%#include "button.h" %>
<%
QString lang = httpRequest().cookie("lang");
QVariantMap qMap = httpRequest().queryItems();
QString tid = tId();

QString action = qMap.contains("action") ? httpRequest().queryItemValue("action"): variant("action").toString();
QString buttonId = qMap.contains("buttonId") ? httpRequest().queryItemValue("buttonId"): variant("buttonId").toString();
Button button = Button::get(hmacVal(buttonId).toInt());

QVariantMap qMapOut;
qMapOut.insert("buttonId",buttonId);
qMapOut.insert("action",action);
%>
<% if (action == "show"){ %>
<!-- show -->
<div id="formButton<%== tid %>" name="formButton" class="form" >
  <table class="layout-fixed" width="100%">
   <tr>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONCD") %>:</td>
      <td><span style="padding-right:30px;" ><%== button.buttonCd() %></span>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONNAMEZH") %>:</td>
      <td><span style="padding-right:30px;" ><%== button.buttonNameZh() %></span>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONNAMEEN") %>:</td>
      <td><span style="padding-right:30px;" ><%== button.buttonNameEn() %></span>
   </tr>
   <tr>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONTOOLTIP") %>:</td>
      <td colspan="5"><span style="padding-right:15px;"><%== button.buttonTooltip() %></span></td>
   </tr>
   <tr>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONDESC") %>:</td>
      <td colspan="5"><span style="padding-right:15px;"><%== button.buttonDesc() %></span></td>
   </tr>
  </table>
</div>
<% }else { %>
<!-- edit -->
<div id="formButton<%== tid %>" name="formButton" class="form" action="/SystemUIsetting/<%== action %>Button">
  <%== inputAuthenticityTag() %>
  <% if (action != "create") { %>
     <input name="buttonId" class="mini-textbox" visible="false" value="<%== buttonId %>"  /> 
  <% } %>
  <table style="width:100%">
   <tr>
      <td style="text-align:right;white-space:nowrap"><b><%== UI("BUTTONCD") %></b>:</td>
      <td><input name="buttonCd" class="mini-textbox" vtype="maxLength:64" style="width:100%" value="<%== button.buttonCd() %>" /></td>
      <td style="text-align:right;white-space:nowrap"><b><%== UI("BUTTONNAMEZH") %></b>:</td>
      <td><input name="buttonNameZh" class="mini-textbox" vtype="maxLength:64" style="width:100%" value="<%== button.buttonNameZh() %>" /></td>
      <td style="text-align:right;white-space:nowrap"><b><%== UI("BUTTONNAMEEN") %></b>:</td>
      <td><input name="buttonNameEn" class="mini-textbox" vtype="maxLength:64" style="width:100%" value="<%== button.buttonNameEn() %>" /></td>
   </tr>
   <tr>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONTOOLTIP") %>:</td>
      <td colspan="5"><input name="buttonTooltip" class="mini-textarea" vtype="maxLength:256" style="width:100%" value="<%== button.buttonTooltip() %>" /></td>
   </tr>
   <tr>
      <td style="text-align:right;white-space:nowrap"><%== UI("BUTTONDESC") %>:</td>
      <td colspan="5"><input name="buttonDesc" class="mini-textarea" style="width:100%" value="<%== button.buttonDesc() %>" /></td>
   </tr>
  </table>
</div>
<% } %>
<!-- toolBar -->
<div class="mini-toolbar" style="border:0px">
</div>
<!-- tabs -->
<div class="mini-fit">
    <% if (action != "create") { %>
    <%== renderPartial("SystemUIsetting/relationOfButton",qMapOut) %> 
    <% } %>
</div>